package com.lzq.his.controller;

import com.lzq.his.domain.DeptMajor;
import com.lzq.his.service.DeptMajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/deptMajor")
public class DeptMajorController {

    @Autowired
    private DeptMajorService deptMajorService;

    @GetMapping
    public List<DeptMajor> selectAll() {
        return deptMajorService.selectAll();
    }

    @PostMapping("/save")
    public void save(@RequestBody DeptMajor deptMajor) {
        System.out.println(deptMajor);
        deptMajorService.save(deptMajor);
    }

    @DeleteMapping("/delete/{id}")
    public void deleteDeptMajor(@PathVariable String id) {
        deptMajorService.deleteById(id);
    }
}
